package com.example.test15middleware;

import com.example.test15middleware.listener.KafkaConsumer;
import com.example.test15middleware.producer.KafkaProducer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;

import java.util.Date;
@Import(KafkaConsumer.class)
@SpringBootApplication
public class Test15MiddlewareApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(Test15MiddlewareApplication.class, args);
        KafkaProducer producer = run.getBean(KafkaProducer.class);
        for(int i=0;i<3;i++){
            producer.send("yun_test",String.valueOf(new Date()));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }

}
